tests: Remove ::event handler in testwindowsize
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 12 Oct 2018 17:45:30 +0000 (19:45 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Mon, 15 Oct 2018 15:39:04 +0000 (17:39 +0200)
We just want widget size here, not windowing configuration events.

tests/testwindowsize.c

index 6e62dd0a600d48ceee02c2c780d45aa7e3228ea6..e938072c33c5da8d09dd094ee7d11d9f83a18e4b 100644 (file)
@@ -8,21 +8,14 @@ static GtkWidget *default_width_spin;
 static GtkWidget *default_height_spin;
 static GtkWidget *resizable_check;
 
-static gboolean
-configure_event_cb (GtkWidget *window, GdkEvent *event, GtkLabel *label)
+static void
+size_changed_cb (GdkSurface *surface, int width, int height, GtkLabel *label)
 {
-  if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
-    {
-      gchar *str;
-      gint width, height;
-
-      gtk_window_get_size (GTK_WINDOW (window), &width, &height);
-      str = g_strdup_printf ("%d x %d", width, height);
-      gtk_label_set_label (label, str);
-      g_free (str);
-    }
-
-  return GDK_EVENT_PROPAGATE;
+  gchar *str;
+
+  str = g_strdup_printf ("%d x %d", width, height);
+  gtk_label_set_label (label, str);
+  g_free (str);
 }
 
 static void
@@ -71,8 +64,9 @@ show_dialog (void)
   //gtk_widget_show (label);
 
   gtk_dialog_add_action_widget (GTK_DIALOG (dialog), label, GTK_RESPONSE_HELP);
-  g_signal_connect (dialog, "event",
-                    G_CALLBACK (configure_event_cb), label);
+  gtk_widget_realize (dialog);
+  g_signal_connect (gtk_widget_get_surface (dialog), "size-changed",
+                    G_CALLBACK (size_changed_cb), label);
 
   gtk_dialog_run (GTK_DIALOG (dialog));